#coding:utf-8
import json
import re
from django.core.mail import send_mail
from django.http import HttpResponse
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.views.decorators.cache import cache_page
from lovewith.album.views.modules.album import AlbumApi
from lovewith.views import site_info
from lovewith.share.views.modules.attach_tag import AttachTagApi
from lovewith.website.views.modules.category import CategoryApi
from lovewith.website.views.modules.link import LinkApi
from lovewith.share.views.modules.attach_flag import AttachFlagApi
from lovewith.share.views.modules.share import ShareApi


#关于我们
def page_about(request):
    share_count = ShareApi.get_total()
    goods_count = AttachFlagApi.get_goods_count()
    album_count = AlbumApi.get_total()

    return render_to_response('website/about.jinja', {
        'share_count': share_count,
        'goods_count': goods_count,
        'album_count': album_count
    }, context_instance=RequestContext(request, processors=[site_info]))


#联系我们
def page_contact(request):
    return render_to_response('website/contact.jinja', {
    }, context_instance=RequestContext(request, processors=[site_info]))


#sitemap
def page_sitemap(request):
    cate_data = CategoryApi.get_hot_tag()

    return render_to_response('website/sitemap.jinja', {
        'cate_data': cate_data
    }, context_instance=RequestContext(request, processors=[site_info]))


#友情链接
def page_link(request):
    return render_to_response('website/link.jinja', {
        'all_link': LinkApi.get_all()
    }, context_instance=RequestContext(request, processors=[site_info]))


#帮助页面
def page_help(request):
    return render_to_response('website/help.jinja', {
    }, context_instance=RequestContext(request, processors=[site_info]))


#采集工具
def page_collection(request):
    return render_to_response('website/collection.jinja', {
    }, context_instance=RequestContext(request, processors=[site_info]))